package Work;

import java.util.IllegalFormatCodePointException;
import java.util.Scanner;
// import java.util.Scanner;
public class Work4 {
    // 斐波那契额数列的所有月份的兔子个数
    public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);
            System.out.print("请输入月数：");
            int m = scanner.nextInt();
            System.out.println("第1个月的兔子对数: 1");
            System.out.println("第2个月的兔子对数: 1");
            int f1=1, f2=1,f;
            for(int i=3;i<=m;i++)
            {
                f=f2;
                f2=f1+f2;
                f1= f;
                System.out.println("第"+i+"个月的兔子对数:"+f2);
            }

    }


    public static void main10(String[] args) {
        Scanner scanner = new Scanner(System.in); // 注意不要忘了是System.out;
        int num1 = 1;
        int num2 = 1;
        int tmp = 0;
        System.out.println("请输入你要的月份:");
        int mou = scanner.nextInt();
        for (int i = 1; i <= mou; i++) {
            if( i <=2) {
                System.out.println("第"+i+"个月"+"兔子的个数为:"+1);
            } else {
                tmp = num2;
                num2 = num2+num1;
                num1 = tmp;
                System.out.println("第"+i+"个月"+"兔子的个数为:"+num2);
            }
        }

    }

    // 弹跳
    public static void main8(String[] args)
    {
        double lucheng=100;
        double high=lucheng/2;
        int i = 0;
        for (i = 2;i<10;i ++) // 注意这里不是1或0 而是2
        {
            lucheng=lucheng+high*2;
            high=high/ 2;
        }
        System.out.println("第"+i+"次落地经过"+lucheng+"米");
        System.out.println("第"+i+"次反弹"+high+"米");
    }



    public static void main9(String[] args) {
        double sum = 100.0; // 注意是double 类型的值，因为要除
        double high = sum /2;
        for (int i = 2; i < 10; i++) {  // 注意不是:等于10 的
            sum = sum + high*2;
            high = high / 2;
        }
        System.out.println("sum:"+sum);
        System.out.println("high:"+high);
    }

    // 利润
    public static void main7(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你的月资");
        double mouth = scanner.nextDouble(); // 注意是: double
        double sum = 0; // 注意 是double
        if( mouth <=10 ) {
            sum = mouth*0.1;
        } else if (mouth > 10 && mouth >20) {
            sum = 10*0.1 + (mouth - 10)*0.075;
        }


    }




    // 猴子摘桃子
    public static void main6(String args[])
    {
        int sum=1;
        for(int i=1;i<10;i++)
        {
            sum=(sum+1)*2;
        }
        System.out.println("猴子第一天一共摘了桃子的个数是："+sum);
    }






    public static void main5(String[] args) {
        int sum = 1;
        for (int i = 1; i < 10; i++) {
            sum = (sum+1)*2;
        }

        System.out.println("桃数"+sum);
    }




    // 求1 到 100 所有得奇数和
    public static void main3(String[] args){
        int sum=0;
        for(int i = 1; i < 100; i += 2){
            sum+=i;
            System.out.println("sum= " + sum);
        }
    }


    public static void main4(String[] args) {
        int sum = 0;
        for (int i = 1; i <= 100; i += 2) {
            sum += i;
            System.out.println(sum);
        }

    }




    // 求因子之和
    public static void main2(String args[]) {
        for(int m=1;m<1000;m++)
        {
            int sum=0;  // 注意这里每次需要重置
            for(int n=1;n<m;n++)
            {
                if(m%n==0)
                {
                    sum=sum+n;
                }
            }
            if(m==sum)
                System.out.println(m);
        }
    }



    public static void main1(String[] args) {
        for (int i = 1; i <= 1000; i++) {
            int sum = 0;
            for (int j = 1; j < i ; j++) {
                if( i % j == 0) {
                    sum += j;
                }
            }

            if(i == sum) {
                System.out.println(i);
            }
        }
    }


}
